package com.example.windowdemo.window.strategy;

import android.view.WindowManager;

import com.example.windowdemo.callback.WindowStrategy;

/**
 * @author: njb
 * @date: 2023/8/3 14:01
 * @desc:
 */
public class FullScreenWindowStrategy implements WindowStrategy {
    @Override
    public void initView(StrategyWindow window) {
        // 初始化全屏窗口界面
    }

    @Override
    public void setFullScreen(StrategyWindow window, boolean isFullScreen) {
        window.layoutParams.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
    }

    @Override
    public void setTitleBar(StrategyWindow window, boolean hasTitleBar) {
        // 不需要实现
    }

    @Override
    public void setSize(StrategyWindow window, int width, int height) {
        window.width = width;
        window.height = height;
        window.layoutParams.width = width;
        window.layoutParams.height = height;
    }

    @Override
    public void setPosition(StrategyWindow window, int x, int y) {
        window.layoutParams.x = x;
        window.layoutParams.y = y;
    }

    @Override
    public void setGravity(StrategyWindow window, int gravity) {
        window.layoutParams.gravity = gravity;
    }
}
